/* 
 * Copyright 2013 Sébastien Mouquet.
 * 
 * This file is part of ECovoiturage.
 * 
 * ECovoiturage is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * ECovoiturage is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Foobar. If not, see http://www.gnu.org/licenses/.
 */
package com.smouquet.ecovoiturage.ui.page.root;

import com.smouquet.ecovoiturage.core.domain.Trajet;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;

/**
 *
 * @author sebastien.mouquet
 */
public class TrajetMidiAddView extends TrajetMidiAbstractView
{
    public static final String VIEW_NAME = "trajetmidi/add";
    
    public TrajetMidiAddView() {}
    

    @Override
    public void enter(ViewChangeEvent event)
    {
        super.enter(event);
        
        ((RootUI)getUI()).setCurrentTrajetMidiId(null);
        
        btnInscription.setEnabled(false);
        btnDeinscription.setEnabled(false);
        btnCommentaire.setEnabled(false);
        tabSheet.setEnabled(false);
    }

    @Override
    protected void doAfterSauvegarder(Trajet trajet)
    {
        RootUI ui = (RootUI)getUI();
        ui.setCurrentTrajetMidiId(trajet.getId());
        ui.doNavigateToTrajetMidiEdit();
    }
}
